<?php


	/*
	 * All rights Reserved, Designed By www.youyacao.com <br>
	 * @Description:视频模块 <br>
	 * @version 蜻蜓C影视追剧系统  <br>
	 * @author:成都市一颗优雅草科技有限公司  <br>
	 * 注意：使用我司开源源代码请遵循license文件的协议仅供个人非盈利使用，禁止用于其他的商业用途
	 * 需要商业用途或者定制开发等可访问songshu.youyacao.com  联系QQ:2853810243 422108995 23625059584
	 * 正版系统查询系统 zhengbancha.youyacao.com
	 */
namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;

class Video extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;
    const TEMPLATE_ID=[
        'sendsub' => 'Pc2yYci9Q5nf5_9J0TcKUeU6tmwvnUh0ZMGv3Oi4HNQ',
    ];
    public function juji()
    {
       return $this->hasOne(Episode::class,'id','episodes_id');
    }
    public function getCover()
    {
        if (Str::contains($this->cover, '//')) {
            return $this->cover;
        }

        return Storage::disk('admin')->url($this->cover);
    }
    public function getUrl()
    {
        if (Str::contains($this->url, '//')) {
            return $this->url;
        }

        return Storage::disk('admin')->url($this->url);
    }
}
